/*
 * Created on Jan 1, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.vectrics.common.reporting.pdf;

import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfPageEvent;
import com.lowagie.text.pdf.PdfWriter;
import org.vectrics.VectricsException;
import org.apache.log4j.*;

/**
 * @author mmoore
 */
public class BasePageEvent implements PdfPageEvent {
	private BaseReport report = null;
	private transient static Logger log = Logger.getLogger(BasePageEvent.class);

	
	public BasePageEvent(BaseReport report) {
		super();
		this.report = report;
	}

	public void onOpenDocument(PdfWriter writer, Document arg1) {
		log.debug("onOpenDocument() - no action");
	}


	public void onStartPage(PdfWriter pdfWriter, Document document) {
		try {
			report.onStartPage(pdfWriter, document);
		}
		catch (VectricsException ve) {
			log.error("VectricsException thrown in onStartPage()", ve);
		}
	}

	public void onEndPage(PdfWriter writer, Document document) {
		try {
			report.onEndPage(writer, document);
		}
		catch (VectricsException ve) {
			log.error("VectricsException thrown in onEndPage()", ve);
		}
	}

	public void onCloseDocument(PdfWriter writer, Document document) {
		log.debug("onCloseDocument() - no action");
	}

	public void onParagraph(PdfWriter arg0, Document arg1, float arg2) {
		log.debug("onParagraph() - no action");
	}

	public void onParagraphEnd(PdfWriter arg0, Document arg1, float arg2) {
		log.debug("onParagraphEnd() - no action");
	}

	public void onChapter(
		PdfWriter arg0,
		Document arg1,
		float arg2,
		Paragraph arg3) {
		
		log.debug("onChapter() - no action");
		
	}

	public void onChapterEnd(PdfWriter arg0, Document arg1, float arg2) {
		log.debug("onChapterEnd() - no action");
		
	}

	public void onSection(
		PdfWriter arg0,
		Document arg1,
		float arg2,
		int arg3,
		Paragraph arg4) {
		log.debug("onSection() - no action");
		
	}

	public void onSectionEnd(PdfWriter arg0, Document arg1, float arg2) {
		log.debug("onSectionEnd() - no action");
	}

	public void onGenericTag(
		PdfWriter arg0,
		Document arg1,
		Rectangle arg2,
		String arg3) {
		// TODO Auto-generated method stub

	}

}
